import request from '@/api/request'

//获取商品列表
function getproductList(start, limit, data) {
    return request({
        url: `/lejuAdmin/product/productsByPage/${start}/${limit}`,
        data,
        method: 'POST'
    })
}
//更改最新状态
function switchNewStatus(data) {
    return request({
        url: "/lejuAdmin/product/switchNewStatus",
        data,
        method: 'POST'
    })
}
//更改推荐状态
function switchRecommandStatus(data) {
    return request({
        url: "/lejuAdmin/product/switchRecommandStatus",
        data,
        method: 'POST'
    })
}
//更改发布状态
function switchPublishStatus(data) {
    return request({
        url: "/lejuAdmin/product/switchPublishStatus",
        data,
        method: 'POST'
    })
}
//更改审核状态
function switchVerifyStatus(data) {
    return request({
        url: '/lejuAdmin/product/switchVerifyStatus',
        data,
        method: 'POST'
    })
}
//删除商品信息
function delProduct(productId, data) {
    return request({
        url: `/lejuAdmin/product/del/${productId}`,
        data,
        method: 'DELETE'
    })
}
//获取sku信息
function getSkusByProductId(productId, data) {
    return request({
        url: `/lejuAdmin/sku/getSkusByProductId/${productId}`,
        data,
    })
}
//添加sku
function addProductSkus(data) {
    return request({
        url: "/lejuAdmin/sku/addProductSkus",
        data,
        method: 'POST'
    })
}
//删除sku
function delSku(skuId, data) {
    return request({
        url: `/lejuAdmin/sku/delSku/${skuId}`,
        data,
        method: 'DELETE'
    })
}
//编辑sku
function updateSkuInfo(data) {
    return request({
        url: '/lejuAdmin/sku/updateSkuInfo',
        data,
        method: 'POST'
    })
}
//查询分类
function getAllCategory(data) {
    return request({
        url: '/lejuAdmin/category/getAllCategory',
        data,

    })
}
//添加商品信息
function addProductAndSkus(data) {
    return request({
        url: '/lejuAdmin/product/addProductAndSkus',
        data,
        method: 'POST'
    })
}
//获取商品详情
function productSkusDetail(productId, data) {
    return request({
        url: `/lejuAdmin/product/productSkusDetail/${productId}`,
        data,
    })
}
//更新商品信息
function updateProductAndSkus(data) {
    return request({
        url: '/lejuAdmin/product/updateProductAndSkus',
        data,
        method: 'POST'
    })
}
//更新分类管理
function updateCategory(data) {
    return request({
        url: '/lejuAdmin/category/updateCategory',
        data,
        method: 'POST'
    })
}
//品牌分页
function findBrandByPage(start, limit, data) {
    return request({
        url: `/lejuAdmin/brand/findBrandByPage/${start}/${limit}`,
        data,

    })
}
//更改品牌显示与隐藏
function switchShowStatus(data) {
    return request({
        url: '/lejuAdmin/brand/switchShowStatus',
        data,
        method: 'POST'
    })
}
//删除品牌
function delBrand(id, data) {
    return request({
        url: `/lejuAdmin/brand/delBrand/${id}`,
        data,
        method: 'DELETE'
    })
}
//添加品牌
function addBrandList(data) {
    return request({
        url: "/lejuAdmin/brand/addBrand",
        data,
        method: 'POST'
    })
}
//更新品牌
function updateBrand(data) {
    return request({
        url: "/lejuAdmin/brand/updateBrand",
        data,
        method: 'POST'
    })
}
export {
    getproductList,
    switchNewStatus,
    switchRecommandStatus,
    switchPublishStatus,
    switchVerifyStatus,
    delProduct,
    getSkusByProductId,
    addProductSkus,
    delSku,
    updateSkuInfo,
    getAllCategory,
    addProductAndSkus,
    productSkusDetail,
    updateProductAndSkus,
    updateCategory,
    findBrandByPage,
    switchShowStatus,
    delBrand,
    addBrandList,
    updateBrand
}